package www.dashu.com.dao;

import www.dashu.com.dao.base.BaseDao;
import www.dashu.com.domain.SysRole;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;

public interface SysRoleDao extends BaseDao<SysRole,Long> {

    @Query(value = "select o from SysRole o where o.id =:id")
    List<SysRole> getSysRoleById(@Param("id") Long id);

    @Modifying
    @Query(value = "delete from SysRole o where o.id = ?1")
    void deleteSysRoleById(Long id);

    @Query(value = "select table_name as name,table_comment as comment  from information_schema.tables where table_schema='smart_mall'", nativeQuery = true)
    List<Map<String,String>> findAllTables();

}